package cn.springcloud.alibaba.auth.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@Slf4j
@Controller
@RequestMapping("/public")
public class PublicController {

	/**
	 * 自定义登录页面
	 */
	@RequestMapping("/login")
	public ModelAndView require(ModelAndView modelAndView, @RequestParam(required = false) String error) {
		if (StringUtils.isNotBlank(error)) {
			log.error(error);
		}
		modelAndView.setViewName("login");//自定义页面名字，resources/templates/login.html
		modelAndView.addObject("error", error);
		return modelAndView;
	}
}
